package com.ah.shanxi_demo.param.result;

import com.ah.shanxi_demo.common.enums.OrderCommonEnum;
import com.ah.shanxi_demo.common.enums.OrderLevelEnum;
import com.ah.shanxi_demo.common.enums.OrderTypeEnum;
import com.ah.shanxi_demo.entity.SxOrder;

import static com.ah.shanxi_demo.sync.utils.DateUtilCustom.df4;
import static com.ah.shanxi_demo.sync.utils.DateUtilCustom.format;

/**
 * @author zt 2020/8/16
 */
public class OrderRO extends SxOrder {

    private String typeName;
    private String levelName;
    private String orderStatusName;
    private String generateTime;

    public String getGenerateTime() {
        return format(getGmtCreate(), df4);
    }

    public String getTypeName() {
        if (null==getType()){
            return "";
        }
        return OrderTypeEnum.convert(getType().toString()).getValue();
    }

    public String getLevelName() {
        if (null==getLevel()){
            return "";
        }
        return OrderLevelEnum.convert(getLevel().toString()).getValue();
    }

    public String getOrderStatusName() {
        if (null==getOrderStatus()){
            return "";
        }
        return OrderCommonEnum.convert(getOrderStatus().toString()).getValue();
    }
}
